﻿@model LotteryVoteMVC.Models.User
@using LotteryVoteMVC.Core
@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>Edit</title>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/comm.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/DynamicRange.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/ajaxHelper.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/comm.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/TableBase.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/inputs.css")" rel="stylesheet" type="text/css" />
</head>
<body class="long">
    @using (Html.BeginForm())
    {
        <table style="text-align: left">
            <thead>
                <tr>
                    <td colspan="2">
                        @Resource.Edit
                    </td>
                </tr>
            </thead>
            <colgroup>
                <col style="width: 25%; text-align: right" />
                <col style="width: 75%; text-align: left" />
            </colgroup>
            <tbody>
                <tr>
                    <td style="background: #00FF7F; color: #fff">
                        @Resource.Password
                    </td>
                    <td style="background: #00FF7F; color: #fff">
                        @Html.PasswordFor(it => it.UserInfo.Password)
                        @Html.ValidationMessageFor(it => it.UserInfo.Password)
                    </td>
                </tr>
                <tr>
                    <td>
                        @Resource.UserName
                    </td>
                    <td>
                    <strong>
                        @Html.DisplayTextFor(it => it.UserName)</strong>
                        @Html.HiddenFor(it => it.UserName)
                    </td>
                </tr>
                <tr>
                    <td>
                        @Resource.Name
                    </td>
                    <td>
                        @Html.TextBoxFor(it => it.UserInfo.Name)
                        @Html.ValidationMessageFor(iterator => iterator.UserInfo.Name)
                    </td>
                </tr>
                <tr>
                    <td>
                        @Resource.Status
                    </td>
                    <td>
                        @Html.DropDownList("UserInfo.State", ViewBag.UserState as IEnumerable<SelectListItem>)
                    </td>
                </tr>
                <tr>
                    <td>
                        @Resource.Currency
                    </td>
                    <td>
                        VND
                    </td>
                </tr>
                <tr>
                    <td>
                        @Resource.GivenCredit
                    </td>
                    <td>
                        @Html.TextBoxFor(it => it.UserInfo.GivenCredit)
                        @Resource.AvailableGivenCredit
                        @ViewBag.CurrentUser.UserInfo.AvailableGivenCredit
                    </td>
                </tr>
                <tr>
                    <td>
                        @Resource.Email
                    </td>
                    <td>
                        @Html.TextBoxFor(it => it.UserInfo.Email)
                        @Html.ValidationMessageFor(it => it.UserInfo.Email)
                    </td>
                </tr>
                <tr>
                    <td>
                        @Resource.Market
                    </td>
                    <td>
                        @Html.CheckBoxList("Species", ViewBag.Species as MultiSelectList, new { disabled = "disabled" })
                    </td>
                </tr>
                @if (Model.Role <= Role.Agent && ViewBag.CanEditShareRate)
                {
                    <tr>
                        <td>
                            @Resource.ShareRateLimit
                        </td>
                        <td>
                            @Resource.Min
                            0%
                            @Resource.Max
                            @CultureHelper.ToPercent(ViewBag.CurrentUser.UserInfo.ShareRate)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            @Resource.ShareRate
                        </td>
                        <td>
                            @Html.TextBox("UserInfo.ShareRate", Model.UserInfo.ShareRate * 100)%
                        </td>
                    </tr>
                }
                @if (Model.Role == Role.Guest)
                {
                    <tr>
                        <td>
                            @Resource.Package
                        </td>
                        <td>
                            @Html.DropDownList("MemberPack", ViewBag.CommGroup as IEnumerable<SelectListItem>)
                        </td>
                    </tr>
                }
                @if (this.HasRight(Model.Role - 1, "AccountController", "Edit"))
                {
                    <tr>
                        <td colspan="2">
                            <input type="submit" id="Submit" name="Submit" value="@Resource.Submit" />
                        </td>
                    </tr>
                }
            </tbody>
        </table>
                if (!ViewBag.CanEditShareRate)
                { 
        @Html.Hidden("UserInfo.ShareRate", Model.UserInfo.ShareRate * 100)
                }
    }
</body>
</html>
